<?php
/***************************************************************************
 *   copyright : (C) 2009 Udrea Cristian
 *   site : http://code.google.com/p/testauction-php
 ***************************************************************************/

/***************************************************************************
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Lesser General Public License as 
 *   published by the Free Software Foundation; either version 2 of the
 *   License, or (at your option) any later version. Although none of the
 *   code may be sold. If you have been sold this script, get a refund.
 ***************************************************************************/
class Loginbox extends Element {
	private $pageval = 1;

	public function showErrors() {
		global $form;
		$user_error=$form->error('user');
		$pass_error=$form->error('pass');
		return $user_error.(($user_error != "") ? "<br />":"").$this->nl().
			$pass_error.(($user_error != "") ? "<br />":"").$this->nl();
	}
	
	public function setPage($page) {
		$this->pageval = $page;
	}
	
	public function toString() {
		global $form;
		$login_user = $form->value('user');
		$login_pass = $form->value('pass');
		return "<tr><td><h2>Login</h2></td></tr>".
			"<tr><td><form action=\"process.php\" method=\"post\">".
			"<fieldset style=\"border: none\">".
			"<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">".
			"<tbody><tr>".
			"<td class=\"IE_blue_font_fix\">User:</td>".
			"<td colspan=\"2\"><input type=\"text\" class=\"old_ie_user\" name=\"lbox_user\" maxlength=\"30\" value=\"" . $login_user . "\"/></td>".
			"</tr><tr>".
			"<td class=\"IE_blue_font_fix\">Parola:</td>".
			"<td><input type=\"password\" class=\"old_ie_password\" name=\"lbox_pass\" size=\"15\" maxlength=\"30\" value=\"" . $login_pass . "\"/></td>".
			"<td><input type=\"hidden\" name=\"sublogin\" value=\"1\"/>".
			"<input type=\"hidden\" name=\"remember\" value=\"0\">".
			"<input type=\"hidden\" name=\"page\" value=\"" . $this->pageval . "\">".
			"<button type=\"submit\" class=\"orange-button\">Login</button></td></tr><tr>".
			"<td colspan=\"3\" style=\"text-align: center\">".
			"<a href=\"main.php?page=20\">Inregistrare</a> | <a href=\"main.php?page=21\">Am uitat Parola</a>".
			"</td></tr></tbody></table></fieldset></form></td></tr>";
	}
}

$login_box = new Loginbox();
?>
